package org.idea.qiyu.threadpool.demo.exception;

/**
 * @Author linhao
 * @Date created in 2:23 下午 2021/11/12
 */
public class RuntimeExceptionHandler {

    public static class TestRuntimeExceptionThread extends Thread{
        public TestRuntimeExceptionThread(){
            super.setName("thread-test-runtime");
        }

        @Override
        public void run() {
            throw new RuntimeException("run time exception");
        }
    }

    public static void main(String[] args) {
            Thread test = new TestRuntimeExceptionThread();
            test.setUncaughtExceptionHandler((Thread t,Throwable e) ->{
                System.out.println(t.getName()+":"+e.getMessage());
            });
            test.start();
    }
}
